package com.itheima.boot.mapper;

import com.itheima.boot.domain.Book;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BookMapper {


    @Insert("insert into tbl_book values(null,#{bookName},#{description},#{price},#{stock},#{status})")
    void add(Book book);


    @Delete("delete from tbl_book where id=#{id}")
    void delete(Integer id);

    @Select("select * from tbl_book where id=#{id}")
    Book  selectById(Integer id);

    @Update("update tbl_book set book_name=#{bookName},description=#{description},price=#{price},stock=#{stock},status=#{status} where id=#{id}")
    void update(Book book);


    List<Book> getAll (Book book);
}